package com.dcms.admin.service.impl;

import com.dcms.admin.bean.Log;
import com.dcms.admin.bean.User;
import com.dcms.admin.dao.LogMapper;
import com.dcms.admin.service.ILogService;
import com.dcms.util.ClassUtil;
import com.dcms.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * \*
 * \* @name: LogServiceImpl
 * \* @author: 武佳伟丶
 * \* @date: 2018/4/6 0006
 * \* @time: 19:22
 * \* @description: To change this template use File | Settings | File Templates.
 * \
 */
@Service
public class LogServiceImpl implements ILogService{

    @Autowired
    private LogMapper mapper;

    @Override
    public int deleteByPrimaryKey(Integer logId) {
        return mapper.deleteByPrimaryKey(logId);
    }


    @Override
    public int insertSelective(Log record) {
        return mapper.insertSelective(record);
    }

    @Override
    public Log selectByPrimaryKey(Integer logId) {
        return mapper.selectByPrimaryKey(logId);
    }

    @Override
    public int updateByPrimaryKeySelective(Log record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<Log> selectAll(String param, Log record) {
        Map map = new HashMap();
        if (StringUtil.isNotEmpty(param)){
            map.put("param", StringUtil.appendPerCent(param));
        }
        map.putAll(ClassUtil.getFields(record));

        return mapper.selectAll(map);
    }
}